/*
 * @description:
 * @Author: lal
 * @Date: 2021-07-15 06:52:10
 * @LastEditors: lal
 * @LastEditTime: 2021-07-15 06:56:31
 */
/*
 * @lc app=leetcode.cn id=392 lang=javascript
 *
 * [392] 判断子序列
 */

// @lc code=start
/**
 * @param {string} s
 * @param {string} t
 * @return {boolean}
 */
var isSubsequence = function (s, t) {
  let sIndex = 0,
    tIndex = 0,
    tLength = t.length,
    sLength = s.length
  while (tIndex < tLength) {
    if (s[sIndex] == t[tIndex]) {
      sIndex++
      //   r如果sIndex长度大于 s字符串长度，说明匹配完了
      if (sIndex > sLength - 1) return true
    }
    tIndex++
  }
  return false
}
// @lc code=end
